<?php

use yii\db\Migration;

/**
 * Handles the creation of table `message`.
 */
class m170930_021815_create_message_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $sql = <<<SQL
CREATE TABLE IF NOT EXISTS `message` (
  `id` int(11) NOT NULL,
  `name` varchar(64) DEFAULT NULL COMMENT '模板名称',
  `theme` varchar(30) DEFAULT NULL COMMENT '模板主题',
  `detail` text COMMENT '模板详情',
  `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间'
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='消息模板表';
ALTER TABLE `message` ADD PRIMARY KEY (`id`);
ALTER TABLE `message` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=7;
SQL;

        $this->execute($sql);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('message');
    }
}
